<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<script>
		var a = 1;

		function check() {
			var b = 234;
			var a = 'aa'
			return function () {
				var c = 456
				var a = 'AA'
				console.log(a); // 当前作用域内找不到a,会向上一层一层查找，最后找到了全局下的a,输出结果为
				console.log(b); // 同理，所以输出"Uncaught ReferenceError: b is not defined"
				debugger;
			}
		}

		var func = check();   // 此时返回匿名函数
		func();               // 执行匿名函数
	</script>
</body>

</html>